home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Various / DevDisk 65 (1989)(DevWare PD).zip / DevDisk 65 (1989)(DevWare PD).adf / ifflib / Examples / Grabber.s < prev    next >
Text File  |  1990-07-11  |  2KB  |  52 lines

  1. * Easy Picture Grabber by CHH & CHW
  2. * This program saves the contents of the first screen as an IFF file
  3. * with filename 'RAM:grabber.pic'. The IFF.library is required.
  4. * If you use the DevPac assembler, enter 'Genim2 Grabber' to assemble.
  5.  
  6. Main:        move.l    4,a6            ; AbsExecBase
  7.         lea    IFFName(PC),a1        ; Library Name
  8.         moveq    #16,d0            ; Required library version
  9.         jsr    -552(a6)        ; OpenLibrary()
  10.         move.l    d0,a4            ; A4 : IFF Library Base
  11.         tst.l    d0            ; Did we get it ?
  12.         bne.s    IFFOpen            ; Yes --->
  13.         moveq    #20,d0            ; Return-code RETURN_FAIL
  14.         rts                ; Return to CLI
  15. IFFOpen:
  16.         lea    IntuiName(PC),a1    ; Intuition Library Name
  17.         jsr    -408(a6)        ; OldOpenLibrary()
  18.         move.l    d0,a5            ; A5 : IntuitionBase
  19.  
  20.         move.l    60(a5),a0        ; IntuitionBase->FirstScreen
  21.         move.l    88(a0),d6        ; Screen.BitMap
  22.  
  23.         move.l    48(a0),a1        ; struct Colormap
  24.         move.l    4(a1),d7        ; struct ColorTable
  25.         lea    44(a0),a1        ; sc_ViewPort
  26.         move.w    32(a1),d1        ; vp_Modes
  27.         moveq    #1,d0            ; Set cruncher-flag
  28.         btst    #11,d1            ; Hold And Modify ?
  29.         beq.s    NoHam            ; no --->
  30.         bset    #7,d0            ; Set HAM-Flag for IFF.lib
  31. NoHam:
  32.         move.l    a4,a6            ; IFFBase
  33.         lea    FileName(PC),a0        ; Name of file to save
  34.         move.l    d6,a1            ; Pointer to BitMap
  35.         move.l    d7,a2            ; Pointer to ColorMap
  36.         jsr    -66(a6)            ; SaveBitMap()
  37.  
  38.         move.l    4,a6            ; AbsExecBase
  39.         move.l    a4,a1            ; IFFBase
  40.         jsr    -414(a6)        ; CloseLibrary() (IMPORTANT!)
  41.  
  42.         move.l    a5,a1            ; IntuitionBase
  43.         jsr    -414(a6)        ; CloseLibrary()
  44.  
  45.         moveq    #0,d0
  46.         rts
  47.  
  48. IFFName:    dc.b    "iff.library",0
  49. IntuiName:    dc.b    "intuition.library",0
  50. FileName:    dc.b    "RAM:grabber.pic",0
  51.  
  52.